﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
//using System.Xml.Linq;
using Telerik.Web.UI;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.Utils;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class RC_InquireSubjects : System.Web.UI.Page
    {
        private SsMng ssMng = new SsMng();
        InquireBLL inquireBLL = new InquireBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //this.lblDate.Text = DateTime.Today.ToString();
                LoadDataGrid();
            }

        }

        private void LoadDataGrid()
        {
            try
            {
                DataSet inquireList = inquireBLL.ListInquire();
                RadGrid2.DataSource = inquireList.Tables[0];
                RadGrid2.DataBind();
            }
            catch (Exception ex)
            {
                Web.ShowAlert(this, ex.Message);
            }
        }

        protected void RadGrid2_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Delete")
                {
                    int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["subj_seq"]);
                    inquireBLL.Delete(seq, ssMng.EmpSeq);
                }

                LoadDataGrid();
            }
            catch (Exception ex)
            {
                Web.ShowAlert(this, ex.Message);
            }
        }
    }
}
